#include "SkillGouzi.h"
#include "Character/SkillPart.h"
#include "Character/MovePart.h"
#include "Character/CreatureMgr.h"

SkillGouzi::SkillGouzi()
{

}

void SkillGouzi::OnDamageTimedo(uint32_t skillId)
{
	cList  targetCidList;
	stSkillInfo *pSkill = m_pPart->GetSkillInfo(skillId);
	MMOLOG_PROCESS_ERROR(pSkill);

	m_pPart->KillTimedo(m_nGlobelID);
	
	m_pPart->FindCreatures(pSkill->_pSkillmeta, m_masterPos, m_skillDir, m_vTargetCids[0], m_targetPos, m_curDamageCount, m_focoTime, targetCidList);

	m_pPart->SkillResult(skillId, pSkill->_pSkillmeta, m_curDamageCount, m_focoTime, targetCidList);

	//技能一次释放完成，需要删通知删除
	m_pPart->RemoveSkillFightInfo(m_nGlobelID);
	return;
Exit0:
	m_pPart->KillTimedo(m_nGlobelID);
	m_pPart->RemoveSkillFightInfo(m_nGlobelID);
}

void SkillGouzi::OnDamageTimedoPlayer(uint32_t skillId, cList & vtargetList)
{
	stSkillInfo *pSkill = m_pPart->GetSkillInfo(skillId);
	MMOLOG_PROCESS_ERROR(pSkill);

	m_pPart->KillTimedo(m_nGlobelID);

	//cList::iterator iter = vtargetList.begin();
	////把所有人拉到一起
	//for (; iter != vtargetList.end(); ++iter)
	//{
	//	Creature * pCreature = g_GetCreatureMgr()->GetCreature(*iter);
	//	if (pCreature)
	//	{
	//		MovePart * pPart = dynamic_cast<MovePart*>(pCreature->GetPart(PART_MOVE));
	//		if (pPart)
	//		{
	//			pPart->Teleporting(m_pPart->GetMasterPos());
	//		}
	//	}
	//}

	m_pPart->SkillResult(pSkill->_Id, pSkill->_pSkillmeta, m_curDamageCount, m_focoTime, vtargetList);

	//技能一次释放完成，需要删通知删除
	m_pPart->RemoveSkillFightInfo(m_nGlobelID);
	return;
Exit0:
	m_pPart->KillTimedo(m_nGlobelID);
	m_pPart->RemoveSkillFightInfo(m_nGlobelID);
}